<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<c:url value='/jquery/jquery.js'/>"></script>
<link  rel="stylesheet"  href="/ajaxweb_mybatis/a.css">
<script type="text/javascript" src="<c:url value='./jquery/customer.js'/>"></script>

<script type="text/javascript">

function initCustomer(){
	var cid =getQueryVariable("cid");
	$.post(getRootPath()+"/AjaxCustomerServlet",
			{
		    method:"getstomerByCid",
		    cid:cid
			},
			function(data){
				//赋值
				$("#cid").val(data.data.cid);
			    $("#cname").val(data.data.cname);
			    $("#gender").val(data.data.gender);
			    $("#cellphone").val(data.data.cellphone);
			    $("#email").val(data.data.email);
			    $("#birthday").val(data.data.birthday);
			},
			"json");
}
  
  $(function(){
	  //初始化，修改页面，接收请求参数，查询当前用户的信息，初始化表单数据
	  initCustomer();
	  $("#btnupdate").click(function(){
		  $.post(getRootPath()+"/AjaxCustomerServlet",
				  //提交表单
				  $("#updateform").serialize(),
				  function(data){
			       if(data.sata==200){
			    	   alert("修改成功");
			    	   //修改成功回首页
			    	   window.location.href=getRootPath()+"/list3.jsp";
			       }
		  },"json")
	  })
  })
</script>

</head>

<body>
     <!--更新页面  -->
     <form id="updateform">
    <!-- 隐藏字段 -->
    <input type="hidden" name="method" value="modifyCustomer"/>
    <input type="hidden" name="cid" id="cid"/>
	      姓名：<input type="text" name="cname" id="cname" /><br/>
	      性别：<select name="gender" id="gender">请选择<br/>
            
		         <option value="">请选择</option><br/>
		         
		         <option value="男">男</option>
		    
		         <option value="女">女</option>

      </select><br/>
	       电话：<input type="text" name="cellphone" id="cellphone"/><br/>
	       邮箱：<input type="text" name="email" id="email"/><br/>
	       生日：<input type="text" name="birthday" id="birthday"/><br/>
	    <input type="button" value="修改" id="btnupdate"/>  
    </form>
   
</body>
</html>